652A - Gabriel and Caterpillar - CodeForces Solution


implementation math *1400

Please click on ads to support us..

C++ Code:

#include <iostream>

using namespace std;

int main() {
    int apple_height, track_height;
    cin >> track_height >> apple_height;

    int a, b;
    cin >> a >> b;

    apple_height -= track_height + 8 * a;
    a = (a - b) * 12;

    int days_to_wait = 0;
    if (apple_height <= 0) {
        days_to_wait = 0;
    }
    else if (a <= 0) {
        days_to_wait = -1;
    }
    else {
        days_to_wait = (apple_height + a - 1) / a;
    }

    cout << days_to_wait;

    return 0;
}


Comments

Submit
0 Comments
More Questions

1728A - Colored Balls Revisited
276B - Little Girl and Game
1181A - Chunga-Changa
1728C - Digital Logarithm
1728D - Letter Picking
792B - Counting-out Rhyme
1195A - Drinks Choosing
5D - Follow Traffic Rules
1272A - Three Friends
1632D - New Year Concert
1400D - Zigzags
716C - Plus and Square Root
412A - Poster
844B - Rectangles
1591A - Life of a Flower
1398C - Good Subarrays
629A - Far Relative’s Birthday Cake
1166A - Silent Classroom
1000B - Light It Up
218B - Airport
1463B - Find The Array
1538C - Number of Pairs
621B - Wet Shark and Bishops
476B - Dreamoon and WiFi
152C - Pocket Book
1681D - Required Length
1725D - Deducing Sortability
1501A - Alexey and Train
721B - Passwords
1263D - Secret Passwords